var $table = $('#announcement_list');
// 获取当前年月
var thisYear = new Date().getFullYear().toString();
var thisMonth = (new Date().getMonth() + 1).toString();
var ymDateStr = thisYear + '-' + thisMonth;

// 初始化招聘看板列表页
$(function () {
    $('select').selectpicker({
        sanitize: true,
        size: 10,
        width:100,
        style:'selRadius'
    })
    // 处理页面有滚动条时，页面右侧边距缩窄
    /*if (window.innerWidth !== $(document).width()) {
        $('.container-fluid').addClass('p-scroll');
    }*/

    // 系统公告
    announcementTableInit();

    // 日期控件
    $('#dateYear').datepicker({
        language: 'zh-CN',
        startView: 'decade',
        endView: 'decade',
        maxViewMode: 'decade',
        minViewMode: 'decade',
        format: 'yyyy',
        autoclose:true,
        /*clearBtn:true,*/
        todayBtn: 'linked',
        todayHighlight: true
    }).datepicker('setDate', thisYear).on('changeDate', function (e) {
        echartsInit($("#dateYear").val())
    }).on('show', function (e) {
        $('th.today').text('返回当前年份');
    });
    var swiper = new Swiper('.swiper-container', {
        slidesPerView: 'auto',
        spaceBetween: 20,
        navigation: {
            nextEl: '.swiper-button-next',
            prevEl: '.swiper-button-prev',
        },
    });
    dataBriefing();

    messageInit();

    // 排行榜筛选
    $('#statisticsYear').datepicker({
        language: 'zh-CN',
        startView: 'decade',
        endView: 'decade',
        maxViewMode: 'decade',
        minViewMode: 'decade',
        format: 'yyyy',
        autoclose:true,
        todayHighlight: true,
    }).on('changeYear', function (ev) {
        // $('#statisticsMonth').datepicker('clearDates');
        $('#statisticsMonth').val('').prop('disabled', false);
        $('#rankAllData').prop('checked', false);
        setTimeout(function () {
            console.log('changeYear');
            funRankAchieve();
        }, 100);
    });
    $('#statisticsMonth').datepicker({
        language: 'zh-CN',
        startView: 'year',
        endView: 'year',
        maxViewMode: 'year',
        minViewMode: 'year',
        format: 'mm',
        autoclose:true,
        todayHighlight: true,
        clearBtn: true,
    }).on('changeMonth', function (e) {
        $('#rankAllData').prop('checked', false);
        setTimeout(function () {
            console.log('changeMonth');
            funRankAchieve();
        }, 100);
    }).on('clearDate', function () {
        setTimeout(function () {
            console.log('clearMonth');
            funRankAchieve();
        }, 100);
    });
    $('#rankAllData').on('click', function () {
        $('#statisticsYear, #statisticsMonth').val('');
        $('#statisticsMonth').prop('disabled', true);
        funRankAchieve();
    });
    // 排行榜标签切换
    $('#rankTabs span').on('click', function () {
        var flag = $(this).data('tabs');
        $(this).addClass('p-active').siblings('span').removeClass('p-active');
        $('#rankTabActive').val(flag);

        // 切换标签重置筛选条件
        $('#statisticsYear, #statisticsMonth').val('');
        $('#statisticsMonth').prop('disabled', true);
        $('#rankAllData').prop('checked', true);

        // 排行榜单加载
        funRankAchieve();
    });

    // 初始化排行榜单 - 业绩排行
    funRankAchieve();
});

/**
 * 金额转换为千位加逗号分隔
 * @param price    金额数值
 * @param decimal  保留小数的位数
 */
function formatePrice(price, decimal) {
    //金额转换 分->元 保留2位小数 并每隔3位用逗号分开 1,234.56
    var str = price.toFixed(decimal);
    var dotNum;
    decimal > 0 ? dotNum = str.indexOf('.') : dotNum = str.length;
    var intSum = str.substring(0, dotNum).replace( /\B(?=(?:\d{3})+$)/g, ',' );//取到整数部分
    var dot = str.substring(str.length, dotNum)//取到小数部分搜索
    var ret = intSum + dot;
    return ret;
}


/**
 * 审核简报
 * */
function dataBriefing() {
    $.ajax({
        url: '/csdMain/getBriefing',
        type: 'GET',
        dataType: 'JSON',
        success: function (data) {
            if (data.code == '000000') {
                var datas = data.data;
                $('#cntractReview').text(formatePrice(datas.cntractReview || 0));
                $('#customerRelation').text(formatePrice(datas.customerRelation || 0));
                $('#productExchange').text(formatePrice(datas.productExchange || 0));
                $('#bankFlowExamine').text(formatePrice(datas.bankFlowExamine || 0));
                $('#customerProductOrder').text(formatePrice(datas.customerProductOrder || 0));
            } else {
                $.alert({
                    title: '系统提醒',
                    content: '获取审核简报数据失败，错误代码(' + data.code + ')'
                });
            }
        },
        error: function (res) {
            console.log('获取审核简报数据出错，详情：', res);
        }
    })
}

/**
 * 系统公告
 * */
function announcementTableInit() {
    //先销毁表格
    $table.bootstrapTable('destroy');
    $table.bootstrapTable({
        classes: 'table table-noborder table-hover',
        url: '/announcement/pageList',
        method: 'post',
        //请求内容类型
        contentType: "application/x-www-form-urlencoded",
        //数据类型
        dataType: "json",
        //是否显示行间隔色
        striped: true,
        //是否启用排序
        sortable: true,
        //排序方式
        sortOrder: "desc",
        sortName: 'createTm',
        //是否使用缓存
        cache: false,
        //显示隐藏列
        showColumns: false,
        //显示刷新按钮
        showRefresh: false,
        //切换显示样式
        showToggle: false,
        //显示Table脚部
        showFooter: false,
        //是否显示分页
        pagination: true,
        //是否显示分页按钮
        showPaginationSwitch: false,
        //是否启用点击选中行
        clickToSelect: false,
        singleSelect: false,
        //最少要显示的列数
        minimumCountColumns: 2,
        //cell没有值时显示
        undefinedText: '-',
        //分页方式：client客户端分页，server服务端分页
        sidePagination: "server",
        //每页的记录行数
        pageSize: 5,
        //初始化加载第1页，默认第1页
        pageNumber: 1,
        //可供选择的每页的行数
        pageList: "[]",
        //查询参数
        queryParams: queryParams,
        columns: [
            {title: '主键', field: 'notifyId', visible: false},
            {title: '序号', field: 'index', align: 'left', valign: 'middle', width: '60', formatter: indexFormat},
            {title: '标题', field: 'title', align: 'left', valign: 'middle', formatter: operateFormat},
            {title: '发布人', field: 'createPeople', align: 'left', valign: 'middle'},
            {title: '发布时间', field: 'createTm', align: 'right', valign: 'middle', width: '180',
                /*formatter: function (value, row, index) {
                    if (value) {
                        var dateArr = value.split(' ');
                        return '<span class="text-left">' + dateArr[0] + '<br>' + dateArr[1] + '</span>';
                    } else {
                        return value;
                    }
                }*/
            },
        ],
        responseHandler: function (result) {
            if (result.code == "000000") {
                var obj = {
                    "rows": result.data,
                    "total": result.totalRecords
                };
            } else {
                var obj = {
                    "total": 0,
                    "rows": [],
                }
            }
            return obj;
        },
        onLoadSuccess: function () {
        },
        onLoadError: function (status) {
            if (status == 403) {
                $.alert({
                    title: '提示',
                    content: '权限不足！禁止访问！'
                });
            } else {
                // window.location.reload();
                //加载失败时执行
                $.alert({
                    title: '提示',
                    content: '公告数据加载失败，请刷新页面重试!'
                });
            }
        },
        formatLoadingMessage: function () {
            return "请稍等，加载中...";
        }, formatNoMatches: function () {
            return '无符合条件的记录';
        }
    });
}
function indexFormat(value, row, index) {
    return index + 1;
}
function queryParams(params) {
    //搜索条件
    params.searchInfo = $('#searchInfo').val();
    params.pageSize = params.limit;
    params.pageIndex = (params.offset / params.limit) + 1;
    params.sortName = params.sort; //排序列名
    params.sortOrder = params.order;//排序方式
    return params;
}
function operateFormat(value, row, index) {
    // type = 1 为用户模块-公告查看 没有编辑功能
    // let html = '<a class="js-create-tab" href="#!" data-url="/front/announcement/getAnnouncementDetail?id=' + row.notifyId + '">' + value + '</a>';
    let html = '<a class="js-create-tab" href="#!" data-url="/front/announcement/getAnnouncementDetail?id=' + row.notifyId + '&type=' + 1 + '">' + value + '</a>';
    return html;
}

function funRankAchieve() {
    var tabsFlag = $('#rankTabActive').val();
    var dataYear = $('#statisticsYear').val();
    var dataMonth = $('#statisticsMonth').val();
    var datas;
    if (dataYear) {
        dataMonth ? datas = {dateType: 2, combination: dataYear + dataMonth} : datas = {dateType: 1, combination: dataYear}
    } else {
        datas = {
            dateType: '',
            combination: ''
        }
    }

    if(tabsFlag == 0){
        // 业绩排行
        $.ajax({
            type: "post",
            url: "/firstPageController/personalPerformanceRanking",
            data: datas,
            dataType: 'json',
            success: function (data, status) {
                if(data.code=="000000"){
                    // console.log(data.data,9000)
                    var rankList = data.data.list;
                    var d_Ranking=''
                    for(let d=0,len=rankList.length;d<len;d++){
                        if(d>29){
                            break;
                        }
                        if (d < 5) {
                            var imgUrl = '/images/rankImg-0' + (d + 1) + '.png';
                        } else {
                            var imgUrl = '/images/rankImg-default.png';
                        }
                        d_Ranking+=`<div class="b-flex">
                            <!--<div class="r-img"><img src="${imgUrl}" alt=""></div>-->
                            <div class="r-name-money"><p><span>NO.${d+1}</span>${rankList[d].userName}</p> <span>￥${formatPrice(rankList[d].contractActualTotalAmount)}</span></div>
                            <div class="r-company"><span> ${rankList[d].companyName!=null?rankList[d].companyName:''} </span></div>
                            <div class="r-num"><p>联系人数</p><span>${rankList[d].count}</span></div>
                    </div>`

                    }
                    $(".l-wrap").html(d_Ranking)
                }else{
                    $.alert({
                        title: '提示',
                        content: '业绩排行数据加载失败，请刷新页面重试!'
                    });
                    $(".l-wrap").html('')
                }
            },
            error: function () {
                $.alert({
                    title: '提示',
                    content: '业绩排行数据加载失败，请刷新页面重试!'
                });
                $(".l-wrap").html('')
            }
        });
    } else {
        // 产品排行
        $.ajax({
            type: "post",
            url: "/firstPageController/productTurnoverList",
            data: datas,
            dataType: 'json',
            success: function (data, status) {
                if(data.code=="000000"){
                    // console.log(data.data,9000)
                    var d_Ranking=''
                    for(let d=0,len=data.data.length;d<len;d++){
                        if(d > 29){
                            break;
                        }
                        if (d < 5) {
                            var imgUrl = '/images/rankImg-1' + (d + 1) + '.png';
                        } else {
                            var imgUrl = '/images/rankImg-1default.png';
                        }
                        d_Ranking+=`<div class="b-flex product-rank">
                            <div class="r-img"><img src="${imgUrl}" alt=""></div>
                            <div class="r-name-money"><p>${data.data[d].productName}</p> </div>
                            <div class="r-num"><p>￥ ${formatPrice(data.data[d].productFinalPrice)}</p></div>
                    </div>`

                    }
                    $(".l-wrap").html(d_Ranking)
                }else{
                    $.alert({
                        title: '提示',
                        content: '产品排行数据加载失败，请刷新页面重试!'
                    });
                    $(".l-wrap").html('')
                }
            },
            error: function () {
                $.alert({
                    title: '提示',
                    content: '产品排行数据加载失败，请刷新页面重试!'
                });
                $(".l-wrap").html('')
            }
        });
    }

}


function getNum(arr,time){
    var currentData=[];
    currentData=arr.filter((item)=>{
        return item.month==time;
    })
    return currentData.length==1?currentData[0]['num']:0
}
/**
 * 合同趋势
 * */
function echartsInit(currentYear){
    $.ajax({
        type: "get",
        url: "/csdMain/listCsdContractReport?year="+currentYear,
        dataType: 'json',
        async:false,
        success: function (data, status){
            if(data.code=='000000'){
                let xAxisData=[];
                let months=['01','02','03','04','05','06','07','08','09','10','11','12'];
                months.filter(function(item){
                    xAxisData.push(currentYear+'-'+item)
                });
                line_option.xAxis[0].data = ['1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月'];
                var createArr=data.data.create;
                var passArr=data.data.pass;
                var failArr=data.data.fail;
                var effectArr=data.data.effect;
                var createData=[],passData=[],failData=[],effectData=[];
                xAxisData.filter(function(item){
                    createData.push(getNum(createArr,item));
                    passData.push(getNum(passArr,item));
                    failData.push(getNum(failArr,item));
                    effectData.push(getNum(effectArr,item));
                })
                line_option.series[0].data = createData;

                line_option.series[1].data = passData;

                line_option.series[2].data = effectData;

                line_option.series[3].data = failData;
                myChart.setOption(line_option);
                window.onresize = myChart.resize;
            } else {
                $.alert({
                    title: '提示',
                    content: '合同趋势数据加载失败，请刷新页面重试!'
                });
            }
        },
        error: function() {
            $.alert({
                title: '提示',
                content: '合同趋势数据加载失败，请刷新页面重试!'
            });
        }
    })
}
var eLine = document.getElementById("e-line")
let myChart = echarts.init(eLine);
const color = ['#778ED9', '#78C9BC','#AA8AE6','#E1B2B0'];
var line_option={
    legend: {
        show: true,
        icon: 'circle',
        right: '20',
        itemWidth: 10,
    },
    grid: {
        left: '20',
        right: '20',
        bottom: '40',
        top: '30',
        containLabel: true
    },
    tooltip: {
        trigger: 'axis',
        extraCssText: 'font-size:14px;line-height:24px;color:#567;background:#fff;padding:luck-table10px;box-shadow:0 0 3px rgba(0, 0, 0, 0.2)',
        formatter: function(params) {
            let html = ''
            params.forEach(v => {
                html += `<div><span style="display:inline-block;color: #999999;margin-right:5px;border-radius:10px;width:10px;height:10px;background-color:${color[v.componentIndex]};"></span>${v.seriesName}：<span style="color:${color[v.componentIndex]};font-size:18px;font-weight:700;padding-left: 10px;">${v.value}</span>`
            })
            return html
        },
        axisPointer:{
            type: 'cross',
            label: {
                backgroundColor: '#6a7985'
            }
        }
    },

    xAxis: [{
        show: true,
        default: 15,
        type: 'category',
        axisLine: {
            show: true,
            lineStyle:{
                color:'rgba(83, 83, 83,0.1)',
            }

        },
        axisTick:{//坐标轴刻度相关设置。
            show: false,
        },
        splitArea: {
            // show: true,
            color: '#f00',
            lineStyle: {
                color: '#f00'
            },
        },
        axisLabel: {
            color: '#999999',
            margin: 20,//刻度标签与轴线之间的距离。
            interval: 0,
        },
        splitLine: {
            show: false
        },
        boundaryGap: false,
        data: [],

    }],
    yAxis: [{
        type: 'value',
        min: 0,
        name:'(个数)',
        nameTextStyle:{
            fontSize:14,
            padding:[0,10,0,0],
            color:'#5A6775',
            fontWeight:400
        },
        // max: 140,
        splitNumber: 4,
        splitLine: {
            show: true,
            lineStyle: {
                //坐标轴在 grid 区域中的分隔线。
                color: '#333'
            }
        },
        axisLine: {
            //坐标轴轴线相关设置
            show: false,
        },
        axisLabel: {
            show: true,
            textStyle: {
                color: '#999999',
            },
            margin: 20,//刻度标签与轴线之间的距离。
        },
        axisTick: {
            show: false,
        },
    }],
    series: [
        {
            name: '创建会员',
            type: 'line',
            smooth: true, //是否平滑
            showAllSymbol: false,
            symbol: 'circle',
            symbolSize: 2,
            lineStyle: {
                normal: {
                    color: "#778ED9",
                },
            },
            markArea: {
                data: [
                    [{
                        yAxis: 0,
                        itemStyle: {
                            color: '#F9FAFC'
                        },
                    }, {
                        yAxis: 100000000
                    }]
                ]
            },
            itemStyle: {
                color: "#778ED9",
            },
            areaStyle: {
                normal: {
                    color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                        offset: 0,
                        color: 'rgba(119, 142, 217, .5)'
                    },
                        {
                            offset: 1,
                            color: 'rgba(119, 142, 217,0)'
                        }
                    ], false),
                    shadowColor: 'rgba(119, 142, 217, 0.9)',
                    shadowBlur: 20
                }
            },
            data: [ ]
        },
        {
            name: '通过会员',
            type: 'line',
            smooth: true, //是否平滑
            showAllSymbol: false,
            symbol: 'circle',
            symbolSize: 2,
            lineStyle: {
                normal: {
                    color: "#78C9BC",
                },
            },
            itemStyle: {
                color: "#78C9BC",
            },
            areaStyle: {
                normal: {
                    color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                        offset: 0,
                        color: 'rgba(120, 201, 188, .5)'
                    },
                        {
                            offset: 1,
                            color: 'rgba(120, 201, 188,0)'
                        }
                    ], false),
                    shadowColor: 'rgba(120, 201, 188, 0.9)',
                    shadowBlur: 20
                }
            },
            data: [ ]
        },
        {
            name: '生效会员',
            type: 'line',
            smooth: true, //是否平滑
            showAllSymbol: false,
            symbol: 'circle',
            symbolSize: 2,
            lineStyle: {
                normal: {
                    color: "#AA8AE6",
                },
            },
            itemStyle: {
                color: "#AA8AE6",
            },
            areaStyle: {
                normal: {
                    color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                        offset: 0,
                        color: 'rgba(170, 138, 230, .5)'
                    },
                        {
                            offset: 1,
                            color: 'rgba(170, 138, 230,0)'
                        }
                    ], false),
                    shadowColor: 'rgba(170, 138, 230, 0.9)',
                    shadowBlur: 20
                }
            },
            data: [ ]
        },
        {
            name: '未通过',
            type: 'line',
            smooth: true, //是否平滑
            showAllSymbol: false,
            symbol: 'circle',
            symbolSize: 2,
            lineStyle: {
                normal: {
                    color: "#E1B2B0",
                },
            },
            itemStyle: {
                color: "#E1B2B0",
            },
            areaStyle: {
                normal: {
                    color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                        offset: 0,
                        color: 'rgba(225, 178, 176, .5)'
                    },
                        {
                            offset: 1,
                            color: 'rgba(225, 178, 176,0)'
                        }
                    ], false),
                    shadowColor: 'rgba(225, 178, 176, 0.9)',
                    shadowBlur: 20
                }
            },
            data: [ ]
        },

    ]
};
// myChart.setOption(line_option);

echartsInit($("#dateYear").val()?$("#dateYear").val():(new Date()).getFullYear())


function messageInit() {
    //先销毁表格
    $('#messageTable').bootstrapTable('destroy');
    $('#messageTable').bootstrapTable({
        classes: 'table table-noborder table-hover',
        url: '/message/selectMessageList',//请求地址
        method: 'post',//请求方式
        contentType: "application/x-www-form-urlencoded",//请求内容类型
        dataType: "json",//数据类型
        striped: false,//是否显示行间隔色
        sortable: true,//是否启用排序
        sortOrder: "desc",//排序方式
        sortName: 'createTm',//排序字段
        cache: false,//是否使用缓存
        showColumns: false,//显示隐藏列
        showRefresh: false,//显示刷新按钮
        showToggle: false,//切换显示样式
        showFooter: false,//显示Table脚部
        pagination: true,//是否显示分页
        showPaginationSwitch: false,//是否显示分页按钮
        clickToSelect: false,//是否启用点击选中行
        singleSelect: false,
        minimumCountColumns: 2,//最少要显示的列数
        undefinedText: '-',//cell没有值时显示
        sidePagination: "server",//分页方式：client客户端分页，server服务端分页
        uniqueId: 'messageId',
        idField: 'messageId',
        pageSize: 4,//每页的记录行数
        pageNumber: 1,//初始化加载第1页，默认第1页
        pageList: [],//可供选择的每页的行数
        queryParams: function queryParams(params) {
            params.pageSize = params.limit;
            params.pageIndex = (params.offset / params.limit) + 1;
            params.sortName = params.sort; //排序列名
            params.sortOrder = params.order;//排序方式
            //普通搜索条件
            params.newsType = '4';  //0已读消息 1未读消息 2审批消息 3汇款消息 4系统消息
            params.sentMessage = '2';
            params.bs = '1';  //0管理 1用户
            return params;
        },//查询参数
        columns: [
            {title: '主键', field: 'messageId', visible: false},
            {title: '发送人id', field: 'senderId', visible: false},
            // {title: '', field: 'checked',checkbox: true, align: 'right',valign: 'middle',width:10},
            {title: '序号', field: 'index', align: 'left', valign: 'middle', width: '60', formatter: indexFormat},
            {title: '主题', field: 'theme', align: 'left', valign: 'middle', formatter: themeHtml, events:themeEvents},
            {title: '发送人', field: 'senderName', align: 'left', valign: 'middle', visible: true},
            {title: '发送时间', field: 'sendTm', align: 'right', valign: 'middle', visible: true,
                /*formatter: function (value, row, index) {
                    if (value) {
                        var dateArr = value.split(' ');
                        return '<span class="text-left">' + dateArr[0] + '<br>' + dateArr[1] + '</span>';
                    } else {
                        return value;
                    }
                }*/
            },
        ],
        responseHandler: function (result) {
            if (result.code == "000000") {
                var obj = {
                    "rows": result.data,
                    "total": result.totalRecords//总条数
                };

            } else {
                var obj = {
                    "total": 0,
                    "rows": [],
                }
            }
            return obj;
        },
        onLoadSuccess: function (data) {
            //加载成功时执行
            // $("[data-toggle='tooltip']").tooltip();//加这个是为了让操作列的提示图标显示在上方

            // 加载完数据更新系统右上角消息数量
            if ($("#newsType").val() == '1') {
                // console.log('未读消息列表');
                var iframeDom = $(window.parent.document);
                iframeDom && iframeDom.find('#unreadCount').text(data.total);
            }
        },
        onLoadError: function (status) {
            if (status == 403) {
                alert("权限不足！禁止访问！");
            } else {
                //加载失败时执行
                alert("加载失败！");
            }
        },
        formatLoadingMessage: function () {
            return "请稍等，加载中...";
        },
        formatNoMatches: function () {
            return '无符合条件的记录';
        },
    });
}

function themeHtml(value,row,index) {
    let html='';
    html=`<a href="#" id="themeId">${value}</a>`;
    return html;
}
window.themeEvents={
    "click #themeId":function (e,value,row,index) {

        let msgType=''
        if($("#sentMessage").val()==1){
            msgType=1
        }else{
            msgType=2
        }
        parent.$(parent.document).data('multitabs').create({
            iframe: true,
            title: '回复信息',
            url: "/front/messageManager/messageDetailUser?messageId="+row.messageId + "&msgType=" + msgType
        }, true);
    }
}

/**
 * 金额格式化函数
 * 将字符串中的整数或者浮点数格式化为千分位表示
 * 示例：formatPrice('$9999999'); // output $9,999,999
 *		formatPrice('今天我赚了$1000块'); // output 今天我赚了$1,000块
 *		formatPrice('今天我赚了$3000块，吃饭花了$100，给妹纸$1888零花钱'); // 今天我赚了$3,000块，吃饭花了$100，给妹纸$1,888零花钱
 * 		formatPrice('12345678.8654321'); //output "12,345,678.8654321"
 *		formatPrice('12345678.8654321.'); //output "12,345,678.8654321."
 *		formatPrice('12345678.8654321.6766'); //output "12345678.8654321.6766" 非标准浮点数，跳过
 * @param String|Number str 原始字符串或金额
 *
 */
function formatPrice(str){
    return String(str).replace(/\d+(?:\.\d+)*/g,function(price){
        var arr=price.split('.');
        if(arr.length>2){
            return price;
        }
        arr[0]=arr[0].replace(/(\d{1,3})(?=(\d{3})+$)/g, '$1,');
        return arr.join('.');
    });
}

function goPage(type){
    if(type=='contract'){
        openTab('合同审核','/front/contractReviewManager/contractReviewForm?contractReviewStatus=0');
    }else if(type=='relate'){
        openTab('关联审核','/front/customerRelationManager/customerRelationForm');
    }else if(type=='exchange'){
        openTab('兑换审核','/front/contractReviewManager/exchangeReview');
    }else if(type=='returnMoney'){
        openTab('回款审核','/front/finance/returnMoneyExamine');
    }else if(type=='refund'){
        openTab('退款审核','/front/contractReviewManager/refundReview');
    }
}